package com.example.hospitalsystem.controller;

import com.example.hospitalsystem.pojo.dto.notice.NoticePageQueryDto;
import com.example.hospitalsystem.result.Result;
import com.example.hospitalsystem.service.NoticeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/notice")
@Tag(name = "11.通知模块")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @Operation(summary = "获取最新通知")
    @GetMapping("/getnewest")
    public Result getNewestNotice(){
        return noticeService.getNewest();
    }


    @Operation(summary = "获取前10条通知")
    @GetMapping("/getTopTen")
    public Result getTopTenNotice(){
        return noticeService.getTopTen();
    }

    @Operation(summary = "删除通知信息")
    @DeleteMapping("/deleteNotice/{id}")
    public Result deleteNotice(@PathVariable("id") Integer id){
        return noticeService.deleteNotice(id);
    }

    @Operation(summary = "管理员获取所有通知信息")
    @PostMapping("/getAllNotice")
    public Result getAllNotice(@RequestBody NoticePageQueryDto noticePageQueryDto){
        return noticeService.getAllNotice(noticePageQueryDto);
    }


}
